import { GET_DATA, } from "./actionTypes";
import { call, put } from 'redux-saga/effects';

export function* getData(data) {
    console.log("de");
    try {
        const request = fetch("http://localhost:3006/api/testError");
        const data = yield call(request);
        yield put({type: GET_DATA, payload: { data }});
    }catch(e) {
        console.log(e);
        yield put({type: GET_DATA, payload: { data: { name: "哎呦" } }});
    }
};